package com.mallcloud.mall.mall.api.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mallcloud.mall.common.core.constant.enums.mall.OrderEnum;
import com.mallcloud.mall.common.core.util.ValidGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@ApiModel(value = "MallOrderCouponRefundModel", description = "券退款单")
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("SYS_ORDER_COUPON_REFUND")
public class MallOrderCouponRefundModel implements Serializable {
	private static final long serialVersionUID = 1L;

	@NotNull(message = "ID为空", groups = {ValidGroup.Update.class})
	@JsonSerialize(using = ToStringSerializer.class)
	@TableId(value = "ID", type = IdType.ASSIGN_ID)
	@ApiModelProperty(value = "编号")
	private Long id;

	@ApiModelProperty(value = "订单号")
	@TableField("ORDER_NO")
	private String orderNo;

	@ApiModelProperty(value = "退款单号")
	@TableField("REFUND_NO")
	private String refundNo;

	/**
	 * {@link OrderEnum.StatusRefundEnum}
	 */
	@ApiModelProperty(value = "订单状态")
	@TableField("STATUS")
	private Integer status;

	@ApiModelProperty(value = "是否已退款，1.已退款 0.未退款")
	@TableField("REFUNDED")
	private Boolean hasRefunded;

	@ApiModelProperty(value = "退款金额")
	@TableField("REFUND_MONEY")
	private BigDecimal refundMoney;

	@ApiModelProperty(value = "支付金额")
	@TableField("PAY_MONEY")
	private BigDecimal payMoney;

	@ApiModelProperty(value = "顾客卡号")
	@TableField("CARD_NO")
	private String cardNo;

	@ApiModelProperty(value = "商户号")
	@TableField("MCH_ID")
	private String mchId;

	@ApiModelProperty(value = "门店号")
	@TableField("MKT")
	private String storeNo;

	@ApiModelProperty(value = "退单时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@TableField("REFUND_TIME")
	private Date refundTime;

	@ApiModelProperty(value = "创建时间")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
	private Date createTime;

	@ApiModelProperty(value = "订单版本号，每处理一次订单，版本号+1")
	@TableField("VERSION")
	private String version;

	@ApiModelProperty(value = "失败原因")
	@TableField("EXCEPTIONS")
	private String exceptions;

	@ApiModelProperty(value = "业务数据")
	@TableField("ATTACH")
	private String attach;

	@ApiModelProperty(value = "购买数量")
	@TableField("NUM")
	private Integer num;

	@ApiModelProperty(value = "退款数量")
	@TableField("REFUND_NUM")
	private Integer refundNum;

	@ApiModelProperty(value = "券号")//券期号
	@TableField("COUPON_NO")
	private String couponNo;

	@ApiModelProperty(value = "券兑换金额单价")
	@TableField("COUPON_MONEY")
	private BigDecimal couponMoney;
}
